home *** CD-ROM | disk | FTP | other *** search
-
- /********************************************************************/
- /* SOURCE CODE FILE */
- /********************************************************************/
- /*
- * >>> File name: 6.2 RectObject.c
- *
- * >>> Purpose: Methods for Rectangle Object
- * >>> Project: PoopDraw Version 1
- * >>> Date: 2/20/89
- * >>> By: Adam Treister
- *
- */
- /********************************************************************/
- /* For Your Information 1802 Hillside Rd. SB CA 93101 */
- /********************************************************************/
-
- #include "PoopDrawInc"
-
- /***** Object Type Defs *********************************************/
-
- typedef DrawObjectRec RectObjectRec;
- typedef DrawObjectPtr RectObjectPtr;
- typedef DrawObjectHandle RectObjectHandle;
-
- ObjectHandle NewRectObj(LPtr ParmP);
-
- /***** Public Functions *********************************************/
- /*
- ObjectHandle NewRectObj(LPtr ParmP);
- */
- /***** Private Functions ********************************************/
-
- private ObjDispatch(DrawObjectHandle ObjectH,int Message,LPtr ParmP);
- private Draw(DrawObjectHandle ObjectH);
-
- /********************************************************************/
- /*------------------------------------------------------------------*/
-
-
- ObjDispatch(ObjectH,Message,ParmP)
- DrawObjectHandle ObjectH;
- int Message;
- LPtr ParmP;
-
- {
- switch(Message)
- {
- case DRAW: Draw(ObjectH); break;
-
- default: DrawObjectDispatch(ObjectH,Message,ParmP);
- }
- }
-
- /*-------------------------------------------NEW-----------------*/
- /*
- * Function: -- NewRectObj
- *
- * Date: -- Feb. 20, 1989
- * PoopDraw Version 1 -- Copyright FYI,1989 -- Adam Treister
- /*---------------------------------------------------------------*/
- ObjectHandle NewRectObj(ParmP)
- LPtr ParmP;
- {
- RectObjectHandle obj;
- Rect r;
-
- r = *(Rect *)ParmP;
- SortRect(&r);
- if (EmptyRect(&r)) return(NULL);
-
- obj = _GetHandleToRecord(RectObjectRec);
- NullOutHandle(obj);
- (*obj)->dispatch = ObjDispatch;
- (*obj)->class = RECT;
- Dispatch(obj,INIT,&r);
- Dispatch(obj,INVAL,NULL);
- return((ObjectHandle)obj);
- }
-
-
- /*-------------------------------------------method--------------*/
- /*
- * Function: -- RectDraw
- *
- * Date: -- Feb. 20, 1989
- * PoopDraw Version 1 -- Copyright FYI,1989 -- Adam Treister
- /*---------------------------------------------------------------*/
-
- Draw(ObjectH)
- RectObjectHandle ObjectH;
- {
- if (BitTst(&(*ObjectH)->attributes,VisibleBit))
- {
- register DrawStateRec drawState;
- Rect r;
-
- r = (*ObjectH)->bounds;
- drawState = (*ObjectH)->drawState;
- PenNormal();
- PenPat(**(GetPattern(drawState.fillPat)));
- PaintRect(&r);
- PenPat(**(GetPattern(drawState.penPat)));
- PenSize(drawState.penSize,drawState.penSize);
- FrameRect(&r);
-
- if (BitTst(&(*ObjectH)->attributes,SelectedBit))
- {
- Dispatch(SELF,DRAWHANDLES,NULL);
- }
- }
- }
-